home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
BASIC
/
LIB
/
EVENTSHELL
/
EXTENSION
/
FontPick
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1995-12-25
|
10KB
|
221 lines
Module FontPick
-----------------------------------------------------------------------
FontPick Handling Routines (version 1.07 25-Dec-95)
-----------------------------------------------------------------------
Public Methods Supported:
FN_shell_FontPick_Init Initialises module
PROCshell_AttachPopupFontPicker Attaches the FontPicker to a window/icon
PROCshell_FontPicker_SelectFont
PROCshell_FontPicker_SetTitle
Responses to events raised by other modules
PROCshell_FontPickerOpen
Private Methods Supported:
FN_FontPicker_Selection
FN_FontPicker_Maker
FN_FontPicker_WatchHandler
FN_FontPicker_WatchHandler2
FN_FontPicker_Click
PROCshell_FontPicker_UpdateDisplay
Message Strings required by module
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Public routines..
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%"*|Start FN_shell_FontPick_Init
_shell_FontPick_Init
Define Constants
)&_c_FontPick_Height_Icon% = 26
*&_c_FontPick_Height_Inc_Icon% = 27
+&_c_FontPick_Height_Dec_Icon% = 28
,&_c_FontPick_Aspect_Icon% = 30
-&_c_FontPick_Aspect_Inc_Icon% = 31
.&_c_FontPick_Aspect_Dec_Icon% = 32
the size icons should be a contiguous block..
1&_c_FontPick_Size08_Icon% = 15
2&_c_FontPick_Size10_Icon% = 16
3&_c_FontPick_Size12_Icon% = 17
4&_c_FontPick_Size14_Icon% = 18
5&_c_FontPick_Size18_Icon% = 19
6&_c_FontPick_Size24_Icon% = 20
7&_c_FontPick_Size28_Icon% = 21
8&_c_FontPick_Size36_Icon% = 22
9&_c_FontPick_Size48_Icon% = 23
:&_c_FontPick_Size72_Icon% = 24
<%_c_FontPick_Font_Icon% = 7
=&_c_FontPick_Weight_Icon% = 10
>&_c_FontPick_Style_Icon% = 13
?%_c_FontPick_Font_M_Icon% = 8
@&_c_FontPick_Weight_M_Icon% = 11
A&_c_FontPick_Style_M_Icon% = 14
C&_c_FontPick_Try_Icon% = 34
D%_c_FontPick_Cancel_Icon% = 1
E%_c_FontPick_OK_Icon% = 0
F&_c_FontPick_Display_Icon% = 35
HH_c_FontPick_WindowName$ = "fontpick" :
Template identifier
J&_c_FontPick_MaxHeight% = 99 :
K&_c_FontPick_MinHeight% = 6 :
M&_c_FontPick_MaxAspect% = 1000 :
N&_c_FontPick_MinAspect% = 10 :
Define variables
Q9_m_FontPick_DBoxHandle% = -1 :
DBox window handle
R[_m_FontPick_NotifyFN$ = "" :
FN to call when selection is made in fontpicker dbox
SO_m_FontPick_WindowHandle% = -1 :
Handle of window containing display icon
TT_m_FontPick_DisplayIcon% = -1 :
Handle of icon to display resulting selection
V!_m_FontPick_CurrentFont$ = ""
W _m_FontPick_CurrentX_Pt = 0
X _m_FontPick_CurrentY_Pt = 0
Y+_m_FontPick_DBoxTitle$ = "FontPicker"
[$_m_FontPick_AllowSystemFont% =
_!*|extract FN_FontPicker_Maker
`(*|extract FN_FontPicker_WatchHandler
a)*|extract FN_FontPicker_WatchHandler2
b!*|extract FN_FontPicker_Click
c%*|extract FN_FontPicker_Selection
e!*|Stop FN_shell_FontPick_Init
i+*|Start PROCshell_AttachPopupFontPicker
shell_AttachPopupFontPicker( wh%, menuic%, dispic%, notify_fn$, preopen_FN$ )
shell_WindowLoaded( _c_FontPick_WindowName$ )
wh% > 0
menuic% >= 0
shell_IconSetButtonType( wh%, menuic%, 3 )
shell_EvntAdd_PopUpMenu(
shell_GetWindowIdentifier( wh% ), menuic%, dispic%, -1, notify_fn$, preopen_FN$, _POPUP_TYPE_FONTPICK )
oJ
99,
shell_MessageOneArg( "SHELLMSG37", _c_FontPick_WindowName$ )
r**|Stop PROCshell_AttachPopupFontPicker
v+*|Start PROCshell_FontPicker_SelectFont
shell_FontPicker_SelectFont( font_name$, x_pt, y_pt )
y)_m_FontPick_CurrentFont$ = font_name$
z#_m_FontPick_CurrentX_Pt = x_pt
{#_m_FontPick_CurrentY_Pt = y_pt
**|Stop PROCshell_FontPicker_SelectFont
)*|Start PROCshell_FontPicker_SetTitle
shell_FontPicker_SetTitle( title$ )
#_m_FontPick_DBoxTitle$ = title$
(*|Stop PROCshell_FontPicker_SetTitle
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Responses to events raised by other modules..
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$*|Start PROCshell_FontPickerOpen
*|!PROCshell_FontPickerOpen
!*|!Opens the fontpicker dbox.
shell_FontPickerOpen( window_handle%, display_icon%, menu_icon%, notify_FN$, preopen_FN$ )
._m_FontPick_WindowHandle% = window_handle%
-_m_FontPick_DisplayIcon% = display_icon%
*_m_FontPick_NotifyFN$ = notify_FN$
_m_FontPick_DBoxHandle% = -1
shell_CreateWindowStatic( _c_FontPick_WindowName$, _m_FontPick_DBoxHandle% )
shell_AttachBumpHandler( _m_FontPick_DBoxHandle%, _c_FontPick_Height_Icon%, _c_FontPick_Height_Inc_Icon%, _c_FontPick_Height_Dec_Icon%, _c_FontPick_MinHeight%, _c_FontPick_MaxHeight%, 1,
, "" , "" )
shell_AttachBumpHandler( _m_FontPick_DBoxHandle%, _c_FontPick_Aspect_Icon%, _c_FontPick_Aspect_Inc_Icon%, _c_FontPick_Aspect_Dec_Icon%, _c_FontPick_MinAspect%, _c_FontPick_MaxAspect%, 1,
, "" , "" )
shell_AttachFontMenu( _m_FontPick_DBoxHandle%, _c_FontPick_Font_M_Icon%, _c_FontPick_Font_Icon%, "_FontPicker_Selection", "_FontPicker_Maker" )
shell_AttachClickSelect( _m_FontPick_DBoxHandle%, -1, "_FontPicker_Click" )
shell_AttachIconWatch( _m_FontPick_DBoxHandle%, _c_FontPick_Height_Icon%, "_FontPicker_WatchHandler2" )
shell_AttachIconWatch( _m_FontPick_DBoxHandle%, _c_FontPick_Aspect_Icon%, "_FontPicker_WatchHandler2" )
shell_AttachHelpTag( _m_FontPick_DBoxHandle%, -1, "fpdbox" )
shell_FontMenu_DisallowSystemFont
shell_WindowRetitle( _m_FontPick_DBoxHandle%, _m_FontPick_DBoxTitle$ )
shell_FontPicker_SetFont ( _m_FontPick_CurrentFont$ )
shell_FontPicker_UpdateDisplay
shell_OpenWindowStatic( _m_FontPick_DBoxHandle% )
shell_WindowMoveToPopUpPos( window_handle%, menu_icon%, _m_FontPick_DBoxHandle% )
#*|Stop PROCshell_FontPickerOpen
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Private module routines
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
(*|Start PROCshell_FontPicker_SetFont
shell_FontPicker_SetFont( font$ )
pos%, pos2%
pos% =
font$, "." )
pos% = 0
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Font_Icon%, font$, -1 )
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Weight_Icon%, "<none>", -1 )
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Style_Icon%, "<none>", -1 )
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Font_Icon%,
font$, pos% - 1 ), -1 )
& pos2% =
font$, ".", pos% + 1 )
pos2% = 0
s
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Weight_Icon%,
font$, pos% + 1, pos2% - 1 ), -1 )
\
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Style_Icon%, "<none>", -1 )
z
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Weight_Icon%,
font$, pos% + 1, pos2% - 1 - pos% ), -1 )
h
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Style_Icon%,
font$, pos2% + 1 ), -1 )
'*|Stop PROCshell_FontPicker_SetFont
#*|Start FN_FontPicker_Selection
_FontPicker_Selection( window_handle%, icon_handle%, selection$ )
shell_FontPicker_SetFont( selection$ )
)_m_FontPick_CurrentFont$ = selection$
shell_FontPicker_UpdateDisplay
"*|Stop FN_FontPicker_Selection
.*|Start PROCshell_FontPicker_UpdateDisplay
shell_FontPicker_UpdateDisplay
Read the current status of the dbox and update the font display
icon accordingly..
x_pt, y_pt, font_handle%
Wy_pt =
shell_IconGetData( _m_FontPick_DBoxHandle%, _c_FontPick_Height_Icon% ) )
hx_pt = y_pt * (
shell_IconGetData( _m_FontPick_DBoxHandle%, _c_FontPick_Aspect_Icon% ) ) / 100 )
shell_Fonts_FindFont( _m_FontPick_CurrentFont$, x_pt, y_pt, font_handle% )
shell_Icon_SetFont( _m_FontPick_DBoxHandle%, _c_FontPick_Display_Icon%, font_handle% )
"_m_FontPick_CurrentX_Pt = x_pt
"_m_FontPick_CurrentY_Pt = y_pt
-*|Stop PROCshell_FontPicker_UpdateDisplay
*|Start FN_FontPicker_Maker
_FontPicker_Maker( menu_handle% )
*|Stop FN_FontPicker_Maker
*|Start FN_FontPicker_Click
_FontPicker_Click( window_handle%, icon_handle% )
void%, value$
icon_handle% >= _c_FontPick_Size08_Icon%
icon_handle% <= _c_FontPick_Size72_Icon%
J value$ =
shell_IconGetData( _m_FontPick_DBoxHandle%, icon_handle% )
shell_IconPutData( _m_FontPick_DBoxHandle%, _c_FontPick_Height_Icon%, value$,
shell_EnsurePoll
shell_FontPicker_UpdateDisplay
icon_handle%
_c_FontPick_Cancel_Icon%
5
shell_CloseWindow( _m_FontPick_DBoxHandle% )
_c_FontPick_OK_Icon%
5
shell_CloseWindow( _m_FontPick_DBoxHandle% )
'
_m_FontPick_NotifyFN$ <> ""
void% =
( "FN" + _m_FontPick_NotifyFN$ + "( " +
( 34 ) + _m_FontPick_CurrentFont$ +
( 34 ) + "," +
_m_FontPick_CurrentX_Pt + "," +
_m_FontPick_CurrentY_Pt + " )" )
*
_m_FontPick_DisplayIcon% <> -1
p
shell_IconPutData( _m_FontPick_WindowHandle%, _m_FontPick_DisplayIcon%, _m_FontPick_CurrentFont$,
*|Stop FN_FontPicker_Click
*&*|Start FN_FontPicker_WatchHandler
_FontPicker_WatchHandler( value$ )
shell_FontPicker_UpdateDisplay
/%*|Stop FN_FontPicker_WatchHandler
3'*|Start FN_FontPicker_WatchHandler2
_FontPicker_WatchHandler2( value$ )
shell_FontPicker_UpdateDisplay
8&*|Stop FN_FontPicker_WatchHandler2